package com.zjsd.sqeybusiness.service.impl;

import java.util.Date;
import java.util.List;

import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zjsd.sqeybusiness.mapper.HydjinfoMapper;
import com.zjsd.sqeybusiness.domain.Hydjinfo;
import com.zjsd.sqeybusiness.service.IHydjinfoService;

/**
 * 会员等级Service业务层处理
 * 
 * @author Zheng
 * @date 2025-03-06
 */
@Service
public class HydjinfoServiceImpl implements IHydjinfoService 
{
    @Autowired
    private HydjinfoMapper hydjinfoMapper;

    /**
     * 查询会员等级
     * 
     * @param hydjid 会员等级ID
     * @return 会员等级
     */
    @Override
    public Hydjinfo selectHydjinfoById(Long hydjid)
    {
        return hydjinfoMapper.selectHydjinfoById(hydjid);
    }

    /**
     * 查询会员等级列表
     * 
     * @param hydjinfo 会员等级
     * @return 会员等级
     */
    @Override
    public List<Hydjinfo> selectHydjinfoList(Hydjinfo hydjinfo)
    {
        return hydjinfoMapper.selectHydjinfoList(hydjinfo);
    }

    /**
     * 新增会员等级
     * 
     * @param hydjinfo 会员等级
     * @return 结果
     */
    @Override
    public int insertHydjinfo(Hydjinfo hydjinfo)
    {
        LoginUser user = SecurityUtils.getLoginUser();
        hydjinfo.setCzrid(user.getUser().getUserId());
        hydjinfo.setCzsj(new Date());
        return hydjinfoMapper.insertHydjinfo(hydjinfo);
    }

    /**
     * 修改会员等级
     * 
     * @param hydjinfo 会员等级
     * @return 结果
     */
    @Override
    public int updateHydjinfo(Hydjinfo hydjinfo)
    {
        return hydjinfoMapper.updateHydjinfo(hydjinfo);
    }

    /**
     * 批量删除会员等级
     * 
     * @param hydjids 需要删除的会员等级ID
     * @return 结果
     */
    @Override
    public int deleteHydjinfoByIds(Long[] hydjids)
    {
        return hydjinfoMapper.deleteHydjinfoByIds(hydjids);
    }

    /**
     * 删除会员等级信息
     * 
     * @param hydjid 会员等级ID
     * @return 结果
     */
    @Override
    public int deleteHydjinfoById(Long hydjid)
    {
        return hydjinfoMapper.deleteHydjinfoById(hydjid);
    }
}
